package com.example.demo.mapper;

import com.example.demo.entity.Instrument;
import com.example.demo.entity.Notation;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface NotationMapper {




    //查找所有曲谱信息
    @Select("select * from notation_tb")
    List<Notation> findNotationAll();


    //根据ID查找曲谱信息
    @Select("select * from notation_tb where notation_id = #{notation_id}")
    Notation findNotationById(Integer notationId);


    //添加曲谱信息
    @Insert("insert into notation_tb (name,type,cover_image,notation_image,author_song,author_word) values (#{name},#{type},#{cover_image},#{notation_image},#{author_song},#{author_word})" )
    Integer insertNotation(Notation notation);

    //修改曲谱信息
    @Update("update notation_tb set name=#{name}, type=#{type}, cover_image=#{cover_image}, notation_image=#{notation_image},author_song=#{author_song},author_word=#{author_word} where notation_id=#{notation_id}")
    Integer updateNotation(Notation notation);

    //删除曲谱信息
    @Delete("delete from notation_tb where notation_id = #{notation_id}")
    Integer deleteNotation(Integer notation_id);

    @Select("SELECT * FROM notation_tb ORDER BY view_count DESC LIMIT 5")
    List<Notation> findHotNotations();




}